﻿#函数
# n1 = 255;
# n2 = hex(n1);
# print(n2);

# # #定义函数 和错误和异常
# def my_abs(x):
	# if not isinstance(x,(int,float)):
		# raise TypeError("bad Type");
	# if not x>0 and not x>-5:
		# return x;
	# else:
		# return -x;

# print(my_abs(41));

# #使用pass空函数
# def nopTest():
	# pass;
# nopTest();

# #返回多个值 返回的是（2,4） 一个元祖
# def move():
	# return 2,4
# a = move();
# print(a);

# # 练习
# # 请定义一个函数quadratic(a, b, c)，接收3个参数，返回一元二次方程：
# # ax2 + bx + c = 0
# # 的两个解。
# # 提示：计算平方根可以调用math.sqrt()函数：
# import math;
# def quadratic(a,b,c):
	# x1 = (-b+math.sqrt(b*b - 4*a*c))/2*a
	# x2 = (-b-math.sqrt(b*b - 4*a*c))/2*a
	# return x1,x2;
# x = quadratic(3,5,2);
# print(x);

# #可变参数
# def calc(*nums):
	# sum = 0;
	# for num in nums:
		# sum += num;
	# return sum;
# print(calc(1,2,3,5,6));
# nums = [1,2,3,5,6];
# print(calc(*nums))

# #命名关键字参数 
# def Person(name,age ,**kw):
	# print("name:",name,"age:",age,"other:",kw);
# Person("jing",12,city = 'beijing');
#命名关键字限制
def Person1(name ,age ,* ,city,job):
	print(name,age,city,job);
print(Person1("jing",16,city = "beijing",job = "IT"));
# *args是可变参数，args接收的是一个tuple；
# **kw是关键字参数，kw接收的是一个dict。